<template>
  <div id="app">
    <h2>Vuex</h2>
    <!-- count: {{ $store.state.count }} <br />
    msg: {{ $store.state.msg }} -->
    count: {{ count }} <br />
    msg: {{ msg }}
    <h2>Getters</h2>
    <!-- Reverse msg: {{ $store.getters.reverseMsg }} -->
    Reverse msg: {{ reverseMsg }}
    <h2>Mutations</h2>
    <button @click="increment(3)">mutations</button>
    <h2>Actions</h2>
    <button @click="incrementAsync(6)">actions</button>
    <h2>Module</h2>
    <!-- Cars: {{ $store.state.cart.cars[0] }} - {{ $store.state.cart.cars[1] }} -->
    Cars: {{ cars[0] }} - {{ cars[1] }}
  </div>
</template>

<script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
export default {
  name: 'App',
  computed: {
    ...mapState(['count', 'msg']),
    ...mapState('cart', ['cars']),
    ...mapGetters(['reverseMsg'])
  },
  methods: {
    ...mapMutations(['increment']),
    ...mapActions(['incrementAsync'])
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
